package com.jh.jingfei.repositories;

import com.jh.jingfei.models.RobotGroup;
import com.strongloop.android.loopback.ModelRepository;
import com.strongloop.android.loopback.callbacks.JsonArrayParser;
import com.strongloop.android.loopback.callbacks.ListCallback;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lxb
 * 机组
 */
public class RobotGroupRepository extends ModelRepository<RobotGroup> {
    public RobotGroupRepository() {
        super("RobotGroup", RobotGroup.class);
    }

    // 分页
    public void findAll(int limit, int offset, final ListCallback<RobotGroup> callback) {
        Map<String, Object> params = new HashMap<>(2);

        Map<String, Object> filter = new HashMap<>(2);
        filter.put("limit", limit);
        filter.put("offset", offset);

        params.put("filter", filter);

        invokeStaticMethod("all", params,
                new JsonArrayParser<RobotGroup>(this, callback));
    }
}
